const express = require('express');
const app = express();

// 注册全局解析中间件
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
//配置跨域
const cors = require('cors');
app.use(cors());

// post解析方式包
const bodyParser = require('body-parser')
app.use(bodyParser.urlencoded({ extended: true }));
//使用 /static 作为前缀来加载 public 文件夹下的文件
app.use('/static', express.static(__dirname + '/public'));

const loginapi = require('./api/loginapi');
app.use('/login',loginapi);
const superapi = require('./api/superapi');
app.use('/super',superapi);

// 
const uploadapi = require('./api/uploadapi');
app.use('/upload',uploadapi);
// 房间
const fangjian=require('./api/fangjian')
app.use('/fangjian',fangjian);

// 客房服务
const kefangfuwu=require('./api/kefangfuwu')
app.use('/kefangfuwu',kefangfuwu);

var logs=require('./api/logs');
app.use('/logs',logs)

var pay=require('./api/pay');
app.use('/pay',pay)

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log('express server listen at http://localhost:'+PORT);
});
